import sqlite3

# 连接数据库（若不存在则在当前目录创建）
conn=sqlite3.connect('database.db')

with open("db.sql") as f:
    conn.executescript(f.read())

#获得一个执行句柄，用来执行后面的语句
cur=conn.cursor()
#插入两条数据
cur.execute("INSERT INTO posts (title,content) VALUES(?,?)",
        (
            'flask1 title','content'
        )
)
cur.execute("INSERT INTO posts (title,content) VALUES(?,?)",
        (
            'flask2 title','content'
        )
)
conn.commit()
conn.close()